package com.touni.designpattern.proxypattern;

import com.touni.designpattern.proxypattern.inter.RealShape;
import com.touni.designpattern.proxypattern.inter.Shape;

/**
 * @ClassName : ProxyShape
 * @Description :
 * @Author : lwq
 * @Date: 2020-11-12 16:30
 */
public class ProxyShape implements Shape {
    private Shape realShape;
    private String shapeName;

    public ProxyShape(String shapeName){
        this.shapeName = shapeName;
    }

    @Override
    public void draw() {
        if (realShape == null){
            realShape = new RealShape(this.shapeName);
        }
        realShape.draw();
    }
}
